<template>
    <div id="product_details">
           <el-button type="text" @click="back">返回</el-button><br>
            <div>产品名称：{{this.name}}</div>
            <div>产品价格：{{this.price}}</div>
            <div>产品描述：{{this.description}}</div>
            <div>产品主图：{{this.photo}}</div>
    </div>
</template>
<script>
    export default{
        data(){
            return{
                id:"",
                orderList:[],
                name:"",
                price:"",
                description:"",
                photo:""
            }
        },
        created(){
            this.id=this.$route.query.id;
            this.findById()
        },
        methods:{
            back(){
                this.$router.back();
            },
            findById(){
                this.$axios.get("/product/findById",{params:{id:this.id}}).then((res)=>{
                    console.log(res.data.data);
                    this.orderList.push(res.data.data);
                    this.name=res.data.data.name;
                    this.price=res.data.data.price;
                    this.description=res.data.data.description;
                    this.photo=res.data.data.photo;
                    // console.log(this.orderList)
                })
            }
        }

    }
</script>
<style lang="scss" scoped>
    #product_details{
        padding:20px;
        div{
            margin-top: 10px ;
        }
    }
    
</style>